package com.qf.common;

/**
 * ---厚德载物---
 *
 * @Author wangbo
 * @Date 2024/9/4
 * @Desc 人的一生适可而止
 */
public class R {
    private int code;
    private String msg;
    private Object data;

    public static R ok () {
        return new R(200, "成功");
    }
    //有可能公司状态码不是200
    public static R ok (Object data) {
        return new R(200, "成功", data);
    }
    public static R ok (int code,String msg) {
        return new R(code, msg);
    }
    public static R ok (int code,String msg, Object data) {
        return new R(code, msg, data);
    }
    public static R fail () {
        return new R(500, "失败");
    }
    public static R fail (int code, String msg) {
        return new R(code, msg);
    }
    public R() {
    }

    public R(int code, String msg) {
        this.code = code;
        this.msg = msg;

    }
    public R(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}